id/email
password
forgot password | create account
about | help | prefs
ReadingBatcode reading practice

 

 

String OperationsSubstr2

prev  |  next  |  chance

Notice substr() can also be called with a single argument.

public static String slice(String s) {
    String c = s.substring(s.length() - 1);
    return c;
}
Function Call  Return Value
slice("Car")
slice("Truck")
slice("55684")
slice("Elephant")
slice("Roses")

Experiment with this code on Gitpod.io

⬅ Back